package com.zhang.pojo;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author ZhangJunqi
 * @Date 2022/2/6 -11:02
 */
@Data
@Component
@ConfigurationProperties(prefix = "person")
@Validated //数据校验
public class Person {
    @NotNull(message = "不能为空")
    private String name;
    @Past(message = "日志大于当天")
    private Date date;
    @Size(min = 1,max = 10,message = "map的size需在1~10之间")
    private Map<String,Object> maps;
    private List<Object> lists;
    private Animal animal;
    @Email(message = "邮箱格式错误")
    private String email;
}
